package com.runtime.hongyunuser.service;

import com.github.pagehelper.PageInfo;
import com.runtime.hongyunuser.bean.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

@Transactional
public interface UserService {
    Users login(Users users);

    List<Categories> getMenu();


    PageInfo<OrderDTO> getOrderList(
            Long userId,
            String orderNumber,
            String productNumber, // 新增商品货号参数
            String status,
            LocalDate startDate,
            LocalDate endDate,
            Integer pageNum,
            Integer pageSize
    );

    PageInfo<Useraddresses> selectUserAddresses(Long userId, Integer pageNum, Integer pageSize);


    void clearDefaultAddresses(Long userId);
    // 修改返回值类型为 void，通过异常表示失败
    int setDefaultAddress(Long addressId, Long userId);

    // 获取区域列表
    List<Regions> getRegionsByParentId(Integer parentId);


    // 添加收货地址
    void addUserAddress(Useraddresses useraddresses);

    // 更新收货地址
    void updateUserAddress(Useraddresses useraddresses);

    // 删除收货地址
    void deleteUserAddress(Long addressId, Long userId);

    @Transactional(readOnly = true)
    OrderDTO getOrderDetail(String orderNumber);
    @Transactional(readOnly = true)
    List<OrderItemDTO> getOrderItems(String orderNumber);
    @Transactional(readOnly = true)
    ShippingAddressDTO getOrderShippingAddress(String orderNumber);

    List<Useraddresses> selectUserAddress(Long userId);


    int insertOrder(Orders orders);


}
